package com.jyw.system.domain.dto;

import com.jyw.common.constant.Constants;
import com.jyw.common.utils.bean.BeanUtils;
import com.jyw.system.domain.SysContact;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Arrays;
import java.util.List;

@ApiModel("部门联系人-请求实体")
@Data
@NoArgsConstructor
public class DeptContactDto {
    @ApiModelProperty("主键")
    private Long id;

    @ApiModelProperty("名称")
    private String name;

    @ApiModelProperty("电话")
    private List<String> phone;

    @ApiModelProperty("类型 0默认 1主要")
    private Integer state;

    public DeptContactDto(SysContact contact) {
        BeanUtils.copyProperties(contact,this);
        setPhone(Arrays.asList(contact.getPhone().split(Constants.SEPARATOR)));
    }
}
